var clean=1;
var pageName;
var imageName;

if (document.images) {

  newsovr 			= new Image(113,24); newsovr.src = "../../../../shared/wow-com/images/menu/mainmenu/news-header-on.gif";
  newsoff 			= new Image(113,24); newsoff.src = "../../../../shared/wow-com/images/menu/mainmenu/news-header.gif";

  infoovr 		= new Image(113,24); infoovr.src = "../../../../shared/wow-com/images/menu/mainmenu/info-header-on.gif";
  infooff 		= new Image(113,24); infooff.src = "../../../../shared/wow-com/images/menu/mainmenu/info-header.gif";

  forumsovr 		= new Image(113,24); forumsovr.src = "../../../../shared/wow-com/images/menu/mainmenu/forums-header-on.gif";
  forumsoff 		= new Image(113,24); forumsoff.src = "../../../../shared/wow-com/images/menu/mainmenu/forums-header.gif";

  linksovr 	= new Image(113,24); linksovr.src = "../../../../shared/wow-com/images/menu/mainmenu/links-header-on.gif";
  linksoff 	= new Image(113,24); linksoff.src = "../../../../shared/wow-com/images/menu/mainmenu/links-header.gif";

  supportovr 		= new Image(113,24); supportovr.src = "../../../../shared/wow-com/images/menu/mainmenu/support-header-on.gif";
  supportoff 		= new Image(113,24); supportoff.src = "../../../../shared/wow-com/images/menu/mainmenu/support-header.gif";


  news_iconovr 			= new Image(41,24); news_iconovr.src = "../../../../shared/wow-com/images/menu/mainmenu/news-icon-on.gif";
  news_iconoff 			= new Image(41,24); news_iconoff.src = "../../../../shared/wow-com/images/menu/mainmenu/news-icon-off.gif";

  info_iconovr 			= new Image(41,24); info_iconovr.src = "../../../../shared/wow-com/images/menu/mainmenu/info-icon-on.gif";
  info_iconoff 			= new Image(41,24); info_iconoff.src = "../../../../shared/wow-com/images/menu/mainmenu/info-icon-off.gif";

  forums_iconovr 		= new Image(41,24); forums_iconovr.src = "../../../../shared/wow-com/images/menu/mainmenu/forums-icon-on.gif";
  forums_iconoff 		= new Image(41,24); forums_iconoff.src = "../../../../shared/wow-com/images/menu/mainmenu/forums-icon-off.gif";

  links_iconovr 	= new Image(41,24); links_iconovr.src = "../../../../shared/wow-com/images/menu/mainmenu/links-icon-on.gif";
  links_iconoff 	= new Image(41,24); links_iconoff.src = "../../../../shared/wow-com/images/menu/mainmenu/links-icon-off.gif";

  support_iconovr 		= new Image(41,24); support_iconovr.src = "../../../../shared/wow-com/images/menu/mainmenu/support-icon-on.gif";
  support_iconoff 		= new Image(41,24); support_iconoff.src = "../../../../shared/wow-com/images/menu/mainmenu/support-icon-off.gif"; 



}



function ovrImg( imageName ) {
  if ( document.images ) {
    document[ imageName ].src = eval(imageName + "ovr.src");
  }
}

function offImg( imageName ) {
  if ( document.images ) {
    document[ imageName ].src = eval(imageName + "off.src");
  }
}




window.name= "mainPage";


//Show layer//
function showLayer(layerName){

	obj = document.getElementById(layerName);
	obj.style.visibility="visible";

}

//Hide layer//
function hideLayer(layerName){

	obj = document.getElementById(layerName);
	obj.style.visibility="hidden";

}

function popUp (url, width, height, name) {


		widthHeight = "width=" + width + ",height=" + height;

		winFeatures = "width=" + width + ",height=" + height + ",menubar=no,resizable=no,scrollbars=yes,status=no,toolbar=no,location=no"


			spawn = window.open(url,name,winFeatures);


}




	var styleSheet;

	var agt    = navigator.userAgent.toLowerCase();
	var appVer = navigator.appVersion.toLowerCase();

	var verInt = parseInt(appVer);

	var ie     = (appVer.indexOf('msie') != -1);

	var opera  = (agt.indexOf('opera') != -1);

    var mozilla = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('opera')==-1)
					&& (agt.indexOf('spoofer')==-1) && (agt.indexOf('compatible') == -1)
	                && (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1));

	var ns4     = (mozilla && (verInt == 4));

	if (ie && !opera) {

		styleSheet = document.styleSheets["pageStyle"];


		styleSheet.addRule ("b", "font-size: x-small");
		styleSheet.addRule ("span", "font-size: x-small");
		styleSheet.addRule (".postBody", "font-size: x-small");

	} else if ( mozilla && !ns4 ) {
		styleSheet = document.styleSheets[0];

		styleSheet.insertRule('b { font-size: small; }',styleSheet.cssRules.length);
		styleSheet.insertRule('span { font-size: small; }',styleSheet.cssRules.length);
		styleSheet.insertRule('.postBody { font-size: small; }',styleSheet.cssRules.length);

	}




   function PageQuery(q) {
        if(q.length > 1)
            this.q = q.substring(1, q.length);
        else
            this.q = null;
        this.keyValuePairs = new Array();
        if(q) {
            for(var i=0; i < this.q.split("&").length; i++) {
                this.keyValuePairs[i] = this.q.split("&")[i];
            }
        }
        this.getKeyValuePairs = function() { return this.keyValuePairs; }
        this.getValue = function(s) {
            for(var j=0; j < this.keyValuePairs.length; j++) {
                if(this.keyValuePairs[j].split("=")[0] == s)
                    return this.keyValuePairs[j].split("=")[1];
            }
            return false;
        }

        this.getParameters = function() {
            var a = new Array(this.getLength());
            for(var j=0; j < this.keyValuePairs.length; j++) {
                a[j] = this.keyValuePairs[j].split("=")[0];
            }
            return a;
        }
        this.getLength = function() { return this.keyValuePairs.length; }
   }

    function queryString(key, defaultValue){
        var page = new PageQuery(window.location.search);
        var queryValue = page.getValue(key);
        if (queryValue)
            return unescape(queryValue);
        else
            return defaultValue;
    }

    function setSelectIndexToValue(selectObject, optionValue) {
        if ((selectObject) && (optionValue) && (selectObject[selectObject.selectedIndex].value != optionValue)) {
            var newIndex = 0;
            for (var i = 0; i < selectObject.length; i++) {
                if (selectObject[i].value == optionValue) {
                    newIndex = i;
                    break;
                }
            }
            selectObject.selectedIndex = newIndex;
        }
     }

    function appendUrlParam(source, paramName, paramValue) {
        var result = "";
        if (source != "")
            result = source + '&';
        result = result + paramName + "=" + escape(paramValue);
        return result;
    }

    function insertUrlParam(source, paramName, paramValue) {
        var tempUrl = "";
        var anchorArray = source.split("#");
        var queryArray = anchorArray[0].split("?");
        tempUrl = queryArray[0] + "?";
        if (queryArray.length > 1)
           tempUrl = tempUrl + queryArray[1] + "&";
        tempUrl = tempUrl + paramName + "=" + escape(paramValue);
        if (anchorArray.length > 1)
           tempUrl = tempUrl + "#" + anchorArray[1];
        return tempUrl;
    }


